<?
class blog extends c{
	function def(){
		/*
		$sql="select * from blog order by id desc limit 0,1";
		$rs=mysql_query($sql);
		if($row=mysql_fetch_Array($rs)){
			$title=$row['title'];
			$text=$row['text'];
		}
		$this->set(array(
		'$title'=>$title,
		'$text'=>$text
		));
		*/
	}
	
	function view($id){
		$sql="select * from blog where id=$id";
		$rs=mysql_query($sql);
		if($row=mysql_fetch_Array($rs)){
			$title=$row['title'];
			$text=$row['text'];
			$createAt=$row['createAt'];
			$count=$row['count'];
		}
		$sql="update blog set count=count+1 where id=$id";
		mysql_query($sql);
		$this->set(array(
		'$title'=>$title,
		'$text'=>$text,
		'$createAt'=>$createAt,
		'$count'=>$count
		));
	}
}
?>